package com.thinkcube.edutainment.adapters;

import java.util.ArrayList;

import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.thinkcube.edutainment.R;
import com.thinkcube.edutainment.domain.GlossaryIndex;
@EBean
public class GlossaryIndexAdapter extends BaseAdapter {
	
	@RootContext
	Context context;
	
	ArrayList<GlossaryIndex> indexData;
	
	public ArrayList<GlossaryIndex> getIndexData() {
		return indexData;
	}

	public void setIndexData(ArrayList<GlossaryIndex> indexData) {
		this.indexData = indexData;
	}

	@Override
	public int getCount() {
		
		return indexData.size();
	}

	@Override
	public GlossaryIndex getItem(int position) {
		
		return indexData.get(position);
	}

	@Override
	public long getItemId(int position) {
		
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	    View rowView = inflater.inflate(R.layout.lesson_bar_item, parent, false);
	    TextView title=(TextView) rowView.findViewById(R.id.lesson_title);
	    title.setText(indexData.get(position).getTitle());
		return rowView;
	}

}
